package com.ca.demo.common.base;

/**
 * @Author XieLei
 * @Date 2017/6/22 15:34
 */
public class Response<T> {

    private Integer code = 100;

    private T data;

    private String msg = "";

    public Response(T data) {
        this.data = data;
    }

    public Response(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Response(Integer code) {
        String msg = "";    // TODO 根据code获取msg
        this.code = code;
        this.msg = msg;
    }

    public Response() {
        super();
        this.code = 100;
    }

    public Boolean getSuccess() {
        return this.code == 100;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
